package adapter;

import android.graphics.Color;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import application.App;
import bean.TextBookBean;
import student.andlei.com.student.R;

public class PopupTextBookAdapter extends BaseQuickAdapter<TextBookBean, BaseViewHolder> {
    private final int color;
    private TextBookBean textBookBean;


    public PopupTextBookAdapter(int layoutResId, @Nullable List<TextBookBean> data, @NonNull TextBookBean textBookBean) {
        super(layoutResId, data);
        this.textBookBean = textBookBean;
        color = App.getInstance().getResources().getColor(R.color.color_light_gray);
    }

    @Override
    protected void convert(BaseViewHolder helper, TextBookBean item) {
        helper.setText(R.id.tv_first_layer_chapter_dialog, item.textbook_name);
        View view = helper.getView(R.id.ll_first_layer_chapter_dialog);
        if (item.isSelect) {
            view.setBackgroundColor(color);
        } else {
            view.setBackgroundColor(Color.WHITE);
        }


    }
}
